<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>患者病例 / Medical Records</title>
    <link rel="stylesheet" href="../../lib/layui/css/layui.css"/>
    <script src="../../lib/layui/layui.js"></script>
    <script src="../../js/common.js"></script>
</head>
<body>
<div class="am-fl am-cf">
    <strong class="am-text-primary am-text-lg pagetitle">患者病例</strong> / <small>Medical Records</small>
</div>
<hr>
<br/>
<form class="layui-form layui-col-space5">
    <label class="layui-form-label">日期范围</label>
    <div class="layui-input-inline">
        <input type="text" name="time" class="layui-input" id="test7" placeholder=" - ">
    </div>
    <div class="layui-inline layui-show-xs-block">
        <input type="text" name="pName" placeholder="姓名" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline layui-show-xs-block">
        <input type="text" name="patientCaseHistory" placeholder="病历号" autocomplete="off" class="layui-input">
    </div>
    <div class="layui-inline layui-show-xs-block">
        <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
    </div>
</form>

<div class="layui-col-md9">
    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</body>
</html>

<!-- 开始和截止时间，搜索框的form表单 -->
<script>
    layui.use(['laydate', 'form','table'], function () {
        var laydate = layui.laydate;
        var form = layui.form;
        var table = layui.table;
        //日期范围
        laydate.render({
            elem: '#test7'
            , range: true
        });

        //监听form表单的提交
        form.on('submit(sreach)', function (data) {
           // var a= JSON.stringify(data.field);
            table.reload('test', {
                url: '/JT90/selectPCH',
                where: {
                    time:data.field.time,
                    pName:data.field.pName,
                    patientCaseHistory:data.field.patientCaseHistory
                }
                , page: {
                    curr: 1
                }
            })
            return false;
        });
    });
</script>
<!--数据表格-->
<script>
    layui.use('table', function () {
        var table = layui.table;

        table.render({
            elem: '#test'
            , url:'/JT90/selectPCH'
            , cols: [[
                  {field: 'patientCaseHistory', title: '病历号', width: 124}
                , {field: 'pName', title: '姓名'}
                , {field: 'pGender', title: '性别'}
                , {field: 'pAge', title: '年龄'}
                , {field: 'pPhone', title: '手机号'}
                , {field: 'pAllergy', title: '过敏史'}
                , {field: 'time', title: '开方时间', width: 170}
            ]]
            , response: {
                dataName: 'result' //规定数据列表的字段名称，默认：data   表示这是要解析的参数
            }
            , page:{
                //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip'] //自定义分页布局
                , groups: 5 //只显示 5个连续页码
                , first: false //不显示首页
                , last: false //不显示尾页
                , limit: 5
                , limits: [5, 10, 15, 20]
                , theme: '#44cc33'
            }
        });
    });
</script>